package gold.digger;

import gold.utils.InputUtil;

import java.util.*;

/**
 * Created by fanzhenyu02 on 2021/12/10.
 * common problem solver template.
 */
public class LC893 {
    public long startExecuteTime = System.currentTimeMillis();


    class Solution {
        public int numSpecialEquivGroups(String[] words) {
            Set<String> group = new HashSet<>();
            for (String word : words) {
                List<Character> odd = new ArrayList<>();
                List<Character> even = new ArrayList<>();

                for (int i = 0; i < word.length(); i++) {
                    if (i % 2 == 0) even.add(word.charAt(i));
                    else odd.add(word.charAt(i));
                }

                Collections.sort(odd);
                Collections.sort(even);
                StringBuilder sb = new StringBuilder();
                for (Character character : even) sb.append(character);
                for (Character character : odd) sb.append(character);
                group.add(sb.toString());
            }

            return group.size();
        }
    }

    public void run() {
        Solution solution = new Solution();
        int[] arr = InputUtil.toIntegerArray("[1,2,3]");
        System.out.println(solution.toString());
    }

    public static void main(String[] args) throws Exception {
        LC893 an = new LC893();
        an.run();

        System.out.println("\ncurrent solution total execute time: " + (System.currentTimeMillis() - an.startExecuteTime) + " ms.");
    }
}
